package com.js.mytransitiondemo.before;

// Created by JS on 2021/7/6.

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.js.mytransitiondemo.R;
import com.js.mytransitiondemo.databinding.ActivityBeforeBinding;

public class BeforeActivity extends AppCompatActivity {

    private ActivityBeforeBinding binding;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityBeforeBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        initView();
    }

    private void initView() {
        binding.effect1.setOnClickListener(v -> {
            Intent intent = new Intent(this, BeforeTwoActivity.class);
            intent.putExtra("type", 1);
            startActivity(intent);
            overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
        });
        binding.effect2.setOnClickListener(v -> {
            Intent intent = new Intent(this, BeforeTwoActivity.class);
            intent.putExtra("type", 2);
            startActivity(intent);
            overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
        });
    }
}
